﻿package Leophy.utils {
	import flash.utils.getQualifiedClassName;

	/**
	 * ...
	 * @author TOPHY
	 */
	dynamic public class Debug {

		public static function traceObj(obj : Object,name : String = "",offsetStr : String = "") : void {
			trace(offsetStr + "|-DBG: [" + name + "]:[" + getQualifiedClassName(obj) + "]=[" + obj + "]-----------");
			for (var i in obj) {
				if (typeof(obj[i]) == "object") {
					traceObj(obj[i], i, offsetStr + "\t");
				}else {
					trace(offsetStr + DBG(name) + " [" + i + "]:[" + typeof(obj[i]) + "]=   [" + obj[i] + "]");
				}
			}
			trace(offsetStr + "|-DBG------------------");
		}

		private static function DBG(txt : String = "") : String {
			if (txt == "" || txt == null) {
				return "DBG";
			}
			return txt;
		}
	}
}